import { TabBar } from 'antd-mobile';
import React from "react";
import { Link } from 'react-router-dom';
import "./index.css"
import { NavBar, Icon } from 'antd-mobile';
import { CloseOutline, MoreOutline, SearchOutline } from 'antd-mobile-icons'


export default class TabBarExample extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            title: props.title,
            showBack: props.showBack || false,
        };
    }


    back = (pageText)  => {
        // 左侧返回
        this.props.autoBack()
    };


    render() {
        return (
            <div className="top-div">
                <NavBar
                    mode="light"
                    onLeftClick={this.state.showBack ? this.back : null}
                    // leftContent="Back"
                    leftContent={this.state.showBack ? [
                        <Icon key="0" type="left"/>,
                    ] : []}
                    // rightContent={[
                    //     <Icon key="0" type="search" style={{ marginRight: '16px' }} />,
                    //     <Icon key="1" type="ellipsis" />,
                    // ]}
                >
                    {this.state.title}
                </NavBar>
            </div>
        );
    }
}



